package com.fcat.common.user.service;

import com.alibaba.fastjson.JSONObject;

import com.fcat.common.user.entity.KeycloakRole;
import com.fcat.common.user.entity.User;
import com.fcat.common.user.vo.AdminClientRole;
import com.fcat.common.user.vo.KeycloakUser;
import com.fcat.common.user.vo.UserCreateQuery;

import java.util.List;

public interface KeycloakService {

    JSONObject token(JSONObject jsonObject);

    JSONObject createUser(UserCreateQuery query,String token);

    JSONObject updatePassword(String token, String username, String password);
    JSONObject getUserInfoByUsername(String token,String username);
    JSONObject logout(String token);
    /**
     * 取消token
     *
     * @param token
     * @return
     */
    JSONObject invalidateToken(String token);

    JSONObject delUser(String token, String userId);
    KeycloakUser generateUser(String token);

    //获取可分配的橘色
    JSONObject getAvailableListByClientId(String userId, String clientId, String token);
    //获取已经分配的橘色
    JSONObject getAllocatedListByClientId(String userId, String clientId, String token);
    //分配角色
    JSONObject allocateRoles(List<AdminClientRole> clientRoles,String userId, String clientId, String token);
    //删除角色
    JSONObject deleteRoles(List<AdminClientRole> clientRoles, String userId, String clientId, String token);
    JSONObject getListByClientId(String token,String clientId);

    JSONObject getAvailableClientList(String authorization);
    JSONObject getUserInfo(String token,String keycloakId);

    JSONObject getResources(String authorization);
    List<KeycloakRole> getRolesByUsername(String username);
    List<KeycloakRole> getAllRoles();

    Boolean isAccessToken(String authorization, User user);

    JSONObject getAllResources();
}
